package com.gjzhao.fmmall.service.juc;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Description: 1
 * @Author: gjzhao
 * @Date Created in 2022-03-05 3:52 下午
 */
public class OrderForJMM {

    //volatile 保证可见性
    volatile int number;

    public void setNumber() {
        number = 60;
    }

    AtomicInteger atomicNumber = new AtomicInteger(0);

    public synchronized void setNumberPlusPlus() {
        number = this.atomicNumber.get();
    }

}